import request from '../request';
let api = {
  //不需要登陆
  login: "/api/home/auth/login", //登陆
  register: "/api/home/auth/register", //注册
  logout: "/api/home/auth/logout", //注销
  sendEmail: "/api/home/auth/send-email", //发送邮箱验证码
  retpwd: "/api/home/auth/retrieve-pwd", //找回密码
  cap: "/api/home/auth/login-captcha",
  //需要登陆
  userInfo: "/api/home/user/info", //获取用户详情
  updateUserInfo: "/api/home/user/edit", //修改用户信息
  resepwd: "/api/home/user/reset-pwd", //重置密码
  address: "/api/home/user/shipping-address-list", //获取用户收货地址
  addressAdd: "/api/home/user/shipping-address-add", //新增收货地址
  addressEdit: "/api/home/user/shipping-address-edit", //编辑收货地址
  addressDel: "/api/home/user/shipping-address-del", //删除收货地址
  collectionList: "/api/home/product/collection-list",

  //获取会员等级
  accountList: `/api/home/grade/list`,
  accountExpList: "/api/home/reward/exp-logs-list",
  accountPointList: "/api/home/reward/point-logs-list",
  signin: "/api/home/user/sign-in",
  myBlog: "/api/home/user/my-article-list",
  myEvaluate: "/api/home/user/my-order-comment-list",
  myComments: "/api/home/user/my-article-comment-list"
}
export default {
  /** 
   * 我的博客
   */
  myBlog(params) {
    return request.get(api.myBlog, {
      params
    });
  },
  /** 
   * 我的评价
   */
  myEvaluate(params) {
    return request.get(api.myEvaluate, {
      params
    });
  },
  /** 
   * 我的评论
   */
  myComments(params) {
    return request.get(api.myComments, {
      params
    });
  },
  /** 
   * 签到
   */
  signin(params) {
    return request.get(api.signin, {
      params
    });
  },
  /** 
   * 获取会员积分明细
   */
  accountPointList(params) {
    return request.get(api.accountPointList, {
      params
    });
  },
  /** 
   * 获取会员经验明细
   */
  accountExpList(params) {
    return request.get(api.accountExpList, {
      params
    });
  },
  /** 
   * 获取会员等级
   */
  accountList(params) {
    return request.get(api.accountList, {
      params
    });
  },
  //登陆
  login(params = {}) {
    return request.post(api.login, params);
  },
  //验证码
  cap(params = {}) {
    return request.get(api.cap, {
      params
    });
  },
  //注册
  register(params = {}) {
    return request.post(api.register, params);
  },
  //发送邮箱验证码
  sendEmail(params = {}) {
    return request.post(api.sendEmail, params);
  },
  //注销登陆
  logout(params = {}) {
    return request.post(api.logout, params);
  },
  //找回密码
  retpwd(params = {}) {
    return request.post(api.retpwd, params);
  },
  //获取用户详情
  userInfo(params = {}) {
    return request.get(api.userInfo, {
      params
    });
  },
  //修改用户详情
  updateUserInfo(params = {}) {
    return request.post(api.updateUserInfo, params);
  },
  //重置密码
  resepwd(params = {}) {
    return request.post(api.resepwd, params);
  },
  //获取用户收货地址
  address(params = {}) {
    return request.get(api.address, {
      params
    });
  },
  //新增收货地址
  addressAdd(params = {}) {
    return request.post(api.addressAdd,
      params
    );
  },
  //编辑收货地址
  addressEdit(params = {}) {
    return request.post(api.addressEdit,
      params
    );
  },
  //删除收货地址
  addaddressDelress(params = {}) {
    return request.post(api.addressDel,
      params
    );
  },
  //收藏列表
  collectionList(params = {}) {
    return request.post(api.collectionList,
      params
    );
  },
}
